home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 3 / ct-rom iiib.zip / ct-rom iiib / WINDOWS / DIVERSEN / WINE02BX / DIRED-TR.ELC < prev    next >
Text File  |  1993-03-28  |  6KB  |  74 lines

  1. ;;; compiled by jwz@thalidomide on Tue Aug 18 17:08:57 1992
  2. ;;; from file /u/jwz/emacs19/lisp/dired/dired-trns.el
  3. ;;; emacs version 19.2.2 Lucid.
  4. ;;; bytecomp version 2.08;  2-aug-92.
  5. ;;; optimization is on.
  6. ;;; this file uses opcodes which do not exist in Emacs18.
  7.  
  8. (if (and (boundp 'emacs-version)
  9.      (or (and (boundp 'epoch::version) epoch::version)
  10.          (string-lessp emacs-version "19")))
  11.     (error "This file was compiled for Emacs19."))
  12.  
  13. (defvar dired-trans-map (make-keymap) "\
  14. Array that associates keys with file transformer functions")
  15. (fset 'dired-trans-define '(macro . #[(char &rest body) ";¼ä┴!┬├─┼╞\"DFç" [char char-to-string define-key dired-trans-map function append (lambda (file)) body] 7 "\
  16. Macro that assigns the transformer function (lambda (file) BODY) to 
  17. CHAR (a character or string). BODY must return a string (the transformed
  18. file or whatever. This macro allows easy definition of user specific
  19. transformation functions."]))
  20. (fset 'dired-trans-run #[(transformers file) "└┴\n├#ç" [mapconcat #[(transformer) "└    !┬     \"«ä─┼    \"!ç" [char-to-string transformer lookup-key dired-trans-map error "Undefined transfomer: %s" file] 3] transformers nil] 4 "\
  21. Applies each transformer supplied in the string TRANSFORMERS in sequence
  22. to FILE and returns the concatenation of the results."])
  23. (defvar dired-trans-re-ext "\\.[^.]*\\(\\.Z\\)?$" "\
  24. The part of a filename matching this regexp will be viewed as extension")
  25. (fset 'dired-trans-init #[nil "└    ┬├#ê└    ─┼#ê└    ╞╟#ê└    ╚╔#ê└    ╩╦#ê└    ╠═#ê└    ╬╧#ç" [define-key dired-trans-map "*" (lambda (file) file) "n" #[(file) "└    !«ü┬ç" [file-name-nondirectory file ""] 2] "d" #[(file) "└    !«ü┬ç" [file-name-directory file ""] 2] "b" #[(file) "└┴\n\"ë├─\n\"Oç" [dired-trans-run "n" file 0 string-match dired-trans-re-ext] 6] "e" #[(file) "└    \n\"ë½å\n ─O¬ü┼)ç" [string-match dired-trans-re-ext file e nil ""] 4] "v" #[(file) "└┴\n\"ë├─┼\n\"Oç" [dired-trans-run "n" file 0 string-match ",v$"] 6] "z" #[(file) "└┴\n\"ë├─┼\n\"Oç" [dired-trans-run "n" file 0 string-match "\\.Z$"] 6]] 4 "\
  26. Defines a basic set of useful transformers.
  27.  
  28. *  is a noop that returns the unmodified filename (equivalent to [dbe]).
  29. n  returns the Name component of a filename without directory information
  30. d  returns the Directory component of a filename
  31. b  returns the Basename of a filename, i.e., the name of the file without
  32.    directory and extension (see dired-trans-re-ext)
  33.    A basename with directory component can be obtained by [db].
  34. e  returns the Extension of a filename (i.e., whatever
  35.    dired-trans-re-ext splits off)
  36. v  returns a file without directory and without ,v suffixes if any.
  37. z  returns a file without directory and without .Z suffixes if any."])
  38. (dired-trans-init)
  39. (fset 'dired-trans-mklist #[(files &optional transformers) ":¼âC    ¼é┬├─#G╟V½ë    Q¬é)ç" [files transformers "*" mapconcat #[(file) "└┴\n \"!ç" [shell-quote dired-trans-run transformers file] 4] dired-mark-separator file-list 1 dired-mark-prefix dired-mark-postfix] 4 "\
  40. Takes a list of FILES and applies the sequence of TRANSFORMERS to each
  41. of them. The transformed results are concatenated, separated by 
  42. dired-mark-separator, prefixed by dired-mark-prefix and postfixed by
  43. dired-mark-postfix to generate a file list suitable for a particular shell."])
  44. (defvar dired-trans-starters "[#[]" "\
  45. User definable set of characters to be used to indicate the start of a
  46. transformer sequence")
  47. (defvar dired-trans-enders "[]# ]" "\
  48. User definable set of characters to be used to indicate the end of a
  49. transformer sequence")
  50. (fset 'dired-trans-expand #[(command files) "└ë┴┼╞└#+ç" [nil "" transformers collect-transformers quoted mapconcat #[(char) "└    !\n½ä├    ç    ─ܽä┼├ç½£╟    \"½ì├╔\n \"╠ ç     P ├ç╟    \"½à┼├ç    ╬ܽå╔\n╬\"ç    ç" [char-to-string char quoted nil "\\" t collect-transformers string-match dired-trans-enders dired-trans-mklist files transformers "" dired-trans-starters "*"] 3] command] 4 "\
  51. Takes a shell COMMAND and a list of FILES and substitutes each occurance
  52. of a transformer sequence by an accordingly transformed file list. Special
  53. characters such as [,] or * can be quoted with a backslash."])
  54. (fset 'dired-trans-make #[(command files &optional all-at-once) "└ë ½ù─\"    Ü½ë─╟\"P¬ë    ¬å╚╔╩#*ç" [nil expanded-command fns all-at-once dired-trans-expand command files " *" mapconcat #[(file) "└    \n├#ç" [dired-trans-make command file t] 4] ";"] 4 "\
  55. Takes a shell COMMAND and a list of FILES and returns a command operating
  56. on the list of files (transformed if COMMAND contains transformers). If
  57. ALL-AT-ONCE is t the resulting command will be of the form
  58.   cmd file1 file2 ... fileN
  59. otherwise it will be
  60.   cmd file1; cmd file2; ... cmd fileN;
  61. Both examples assume a single reference to the file list."])
  62. (fset 'dired-shell-stuff-it #[(command file-list on-each &optional raw-arg) "└    \n ?#ç" [dired-trans-make command file-list on-each] 4 "\
  63. Make up a shell command line from COMMAND and FILE-LIST.
  64. If ON-EACH is t, COMMAND should be applied to each file, else
  65.   simply concat all files.
  66. The list of marked files is appended to the command string unless asterisks
  67.   `*' or transformer sequences enclosed in `[]' indicate the place(s) where 
  68.   the (transformed) list should go.  See documentation of function
  69.   dired-trans-init for a list of transformers.
  70. With a zero argument the resulting command will be of the form
  71.   cmd file1; cmd file2; ... cmd fileN assuming only one reference to the
  72.   file list. E.g., to rename all .lsp files into .lisp files mark all the
  73.   .lsp files and issue the command `mv * [db].lisp' ."])
  74.